package cn.sciento.boot.tenant.hiam.api.controller.v1;


import cn.sciento.core.domain.Page;
import cn.sciento.core.iam.ResourceLevel;
import cn.sciento.swagger.annotation.Permission;
import io.choerodon.mybatis.pagehelper.annotation.SortDefault;
import io.choerodon.mybatis.pagehelper.domain.PageRequest;
import io.choerodon.mybatis.pagehelper.domain.Sort;
import io.swagger.annotations.ApiOperation;
import cn.sciento.boot.platform.lov.annotation.ProcessLovValue;
import cn.sciento.boot.tenant.hiam.app.service.TenantInitLogService;
import cn.sciento.boot.tenant.hiam.domain.entity.TenantInitLog;
import cn.sciento.core.base.BaseController;
import cn.sciento.core.util.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@RestController("tenantInitLogController.v1")
@RequestMapping({"/v1/tenant-init-logs"})
public class TenantInitLogController extends BaseController {
  @Autowired
  private TenantInitLogService tenantInitLogService;
  
  @ApiOperation("租户初始化日志列表")
  @Permission(level = ResourceLevel.SITE)
  @GetMapping
  @ProcessLovValue(targetField = {"body"})
  public ResponseEntity<Page<TenantInitLog>> list(TenantInitLog tenantInitLog, @ApiIgnore @SortDefault(value = {"tenantInitLogId"}, direction = Sort.Direction.DESC) PageRequest pageRequest) {
    Page<TenantInitLog> list = this.tenantInitLogService.pageTenantInitTenantInitLog(pageRequest, tenantInitLog);
    return Results.success(list);
  }
}
